1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.PreferencesWindow; 26 27 private import adw.PreferencesPage; 28 private import adw.Toast; 29 private import adw.Window; 30 private import adw.c.functions; 31 public import adw.c.types; 32 private import glib.ConstructionException; 33 private import glib.Str; 34 private import glib.c.functions; 35 private import gobject.ObjectG; 36 private import gtk.Widget; 37 38 39 /** 40 * A window to present an application's preferences. 41 * 42 * <picture> 43 * <source srcset="preferences-window-dark.png" media="(prefers-color-scheme: dark)"> 44 * <img src="preferences-window.png" alt="preferences-window"> 45 * </picture> 46 * 47 * The `AdwPreferencesWindow` widget presents an application's preferences 48 * gathered into pages and groups. The preferences are searchable by the user. 49 * 50 * ## CSS nodes 51 * 52 * `AdwPreferencesWindow` has a main CSS node with the name `window` and the 53 * style class `.preferences`. 54 * 55 * Since: 1.0 56 */ 57 public class PreferencesWindow : Window 58 { 59 /** the main Gtk struct */ 60 protected AdwPreferencesWindow* adwPreferencesWindow; 61 62 /** Get the main Gtk struct */ 63 public AdwPreferencesWindow* getPreferencesWindowStruct(bool transferOwnership = false) 64 { 65 if (transferOwnership) 66 ownedRef = false; 67 return adwPreferencesWindow; 68 } 69 70 /** the main Gtk struct as a void* */ 71 protected override void* getStruct() 72 { 73 return cast(void*)adwPreferencesWindow; 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (AdwPreferencesWindow* adwPreferencesWindow, bool ownedRef = false) 80 { 81 this.adwPreferencesWindow = adwPreferencesWindow; 82 super(cast(AdwWindow*)adwPreferencesWindow, ownedRef); 83 } 84 85 86 /** */ 87 public static GType getType() 88 { 89 return adw_preferences_window_get_type(); 90 } 91 92 /** 93 * Creates a new `AdwPreferencesWindow`. 94 * 95 * Returns: the newly created `AdwPreferencesWindow` 96 * 97 * Since: 1.0 98 * 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 public this() 102 { 103 auto __p = adw_preferences_window_new(); 104 105 if(__p is null) 106 { 107 throw new ConstructionException("null returned by new"); 108 } 109 110 this(cast(AdwPreferencesWindow*) __p); 111 } 112 113 /** 114 * Adds a preferences page to @self. 115 * 116 * Params: 117 * page = the page to add 118 * 119 * Since: 1.0 120 */ 121 public void add(PreferencesPage page) 122 { 123 adw_preferences_window_add(adwPreferencesWindow, (page is null) ? null : page.getPreferencesPageStruct()); 124 } 125 126 /** 127 * Displays @toast. 128 * 129 * See [method@ToastOverlay.add_toast]. 130 * 131 * Params: 132 * toast = a toast 133 * 134 * Since: 1.0 135 */ 136 public void addToast(Toast toast) 137 { 138 adw_preferences_window_add_toast(adwPreferencesWindow, (toast is null) ? null : toast.getToastStruct()); 139 } 140 141 /** 142 * Closes the current subpage. 143 * 144 * If there is no presented subpage, this does nothing. 145 * 146 * Since: 1.0 147 */ 148 public void closeSubpage() 149 { 150 adw_preferences_window_close_subpage(adwPreferencesWindow); 151 } 152 153 /** 154 * Gets whether gestures and shortcuts for closing subpages are enabled. 155 * 156 * Returns: whether gestures and shortcuts are enabled. 157 * 158 * Since: 1.0 159 */ 160 public bool getCanNavigateBack() 161 { 162 return adw_preferences_window_get_can_navigate_back(adwPreferencesWindow) != 0; 163 } 164 165 /** 166 * Gets whether search is enabled for @self. 167 * 168 * Returns: whether search is enabled for @self. 169 * 170 * Since: 1.0 171 */ 172 public bool getSearchEnabled() 173 { 174 return adw_preferences_window_get_search_enabled(adwPreferencesWindow) != 0; 175 } 176 177 /** 178 * Gets the currently visible page of @self. 179 * 180 * Returns: the visible page 181 * 182 * Since: 1.0 183 */ 184 public PreferencesPage getVisiblePage() 185 { 186 auto __p = adw_preferences_window_get_visible_page(adwPreferencesWindow); 187 188 if(__p is null) 189 { 190 return null; 191 } 192 193 return ObjectG.getDObject!(PreferencesPage)(cast(AdwPreferencesPage*) __p); 194 } 195 196 /** 197 * Gets the name of currently visible page of @self. 198 * 199 * Returns: the name of the visible page 200 * 201 * Since: 1.0 202 */ 203 public string getVisiblePageName() 204 { 205 return Str.toString(adw_preferences_window_get_visible_page_name(adwPreferencesWindow)); 206 } 207 208 /** 209 * Sets @subpage as the window's subpage and opens it. 210 * 211 * The transition can be cancelled by the user, in which case visible child will 212 * change back to the previously visible child. 213 * 214 * Params: 215 * subpage = the subpage 216 * 217 * Since: 1.0 218 */ 219 public void presentSubpage(Widget subpage) 220 { 221 adw_preferences_window_present_subpage(adwPreferencesWindow, (subpage is null) ? null : subpage.getWidgetStruct()); 222 } 223 224 /** 225 * Removes a page from @self. 226 * 227 * Params: 228 * page = the page to remove 229 * 230 * Since: 1.0 231 */ 232 public void remove(PreferencesPage page) 233 { 234 adw_preferences_window_remove(adwPreferencesWindow, (page is null) ? null : page.getPreferencesPageStruct()); 235 } 236 237 /** 238 * Sets whether gestures and shortcuts for closing subpages are enabled. 239 * 240 * Params: 241 * canNavigateBack = the new value 242 * 243 * Since: 1.0 244 */ 245 public void setCanNavigateBack(bool canNavigateBack) 246 { 247 adw_preferences_window_set_can_navigate_back(adwPreferencesWindow, canNavigateBack); 248 } 249 250 /** 251 * Sets whether search is enabled for @self. 252 * 253 * Params: 254 * searchEnabled = whether search is enabled 255 * 256 * Since: 1.0 257 */ 258 public void setSearchEnabled(bool searchEnabled) 259 { 260 adw_preferences_window_set_search_enabled(adwPreferencesWindow, searchEnabled); 261 } 262 263 /** 264 * Makes @page the visible page of @self. 265 * 266 * Params: 267 * page = a page of @self 268 * 269 * Since: 1.0 270 */ 271 public void setVisiblePage(PreferencesPage page) 272 { 273 adw_preferences_window_set_visible_page(adwPreferencesWindow, (page is null) ? null : page.getPreferencesPageStruct()); 274 } 275 276 /** 277 * Makes the page with the given name visible. 278 * 279 * Params: 280 * name = the name of the page to make visible 281 * 282 * Since: 1.0 283 */ 284 public void setVisiblePageName(string name) 285 { 286 adw_preferences_window_set_visible_page_name(adwPreferencesWindow, Str.toStringz(name)); 287 } 288 }